/*
 * XMLArbre.cpp
 *
 *  Created on: 12 mars 2012
 *      Author: lsinapayen
 */

#include "XMLArbre.h"
using namespace std;
#include <string>
#include <iostream>
#include <fstream>



XMLArbre::XMLArbre() {
	string vide;

	vide = "";
	this->racine = new Element(&vide,&vide);
}

XMLArbre::XMLArbre(string r) {
	string vide;

	vide = "";
	ContentElement * ce = new ContentElement(&r,&vide);
	this->racine = ce;
}

XMLArbre::~XMLArbre() {
	this->racine->~Element();

}

string * XMLArbre::getDeclaration()
{
    return &declaration;
}

void XMLArbre::setDeclaration(string * declaration)
{
    this->declaration = *declaration;
}

Element * XMLArbre::getRacine()
{
    return racine;
}

void XMLArbre::setRacine(Element * racine)
{
    this->racine->setAttributs(racine->getAttributs());
    this->racine->setItems(racine->getItems());
    this->racine->setName(racine->getName());
    this->racine->setNomspace(racine->getNomspace());
}

vector<string> * XMLArbre::getCommentaires()
{
    return &commentaires;
}

void XMLArbre::setCommentaires(vector<string> * commentaires)
{
	vector<string>::iterator itCom;
	    	itCom = commentaires->begin();
	    	while(itCom!=commentaires->end()){
	    		this->commentaires.push_back((*itCom));
	    		itCom++;
	    	}
}

int XMLArbre::afficher(){
	cout<<this->declaration<<endl;
	this->racine->afficher();
	return 0;
}
